#include "ViewLayout.h"
#include <QWidget>
#include <QToolButton>
#include <QLabel>
#include <QLayout>
#include <iostream>
#include <QLabel>

ViewLayout::ViewLayout()
{
    std::cout << "view start" << std::endl;
    QToolButton* view_2d = new QToolButton;
    view_2d->setText(tr ("2D"));
    this->addWidget(view_2d);

    QToolButton* view_3d = new QToolButton;
    view_3d->setText(tr ("3D"));
    this->addWidget(view_3d);

    QLabel* label = new QLabel;
    label->setText(tr ("2d"));
    this->addWidget(label);
    std::cout << "view end" << std::endl;
}



ViewLayout::ViewLayout(
    QHBoxLayout* layout)
{
    layout->addLayout(this);//addChildLayout(this);
    layout->addSpacing(100);
    this->add_sub_widget ();

    QLabel* lab = new QLabel(tr("11"));
    lab->setMaximumWidth(1);
    lab->setMaximumHeight(200);
    lab->setFrameShape (QFrame::Box);
    lab->setStyleSheet("border-width: 1px;border-style: solid;border-color: rgb(0, 0, 0);");
    layout->addWidget(lab);
}



void
ViewLayout::add_sub_widget ()
{

    QToolButton* view_2d = new QToolButton;
    view_2d->setIcon(QIcon (":/resource/image/earth2D.png"));
    view_2d->setToolTip(tr ("2D视图"));
    this->addWidget(view_2d);

    QToolButton* view_3d = new QToolButton;
    view_3d->setIcon(QIcon (":/resource/image/earth3D.png"));
    view_3d->setToolTip(tr ("3D视图"));
    this->addWidget(view_3d);

    QToolButton* view_brower = new QToolButton;
    view_brower->setIcon(QIcon (":/resource/image/brower.png"));
    view_brower->setToolTip(tr ("浏览窗口"));
    this->addWidget(view_brower);

    QToolButton* view_message = new QToolButton;
    view_message->setIcon(QIcon (":/resource/image/message.png"));
    view_message->setToolTip(tr ("信息窗口"));

    this->setAlignment(Qt::AlignRight);
    this->addWidget(view_message);

}
